#define _CRT_SECURE_NO_WARNINGS 
#include<stdio.h>
#include<assert.h>
char* my_strncpy(char* dest, const char* sor, size_t num)
{
	assert(dest && sor);
	char* ret = dest;
	while (*dest = *sor)
	{
		if (num == 1)
		{
			break;
		}
		dest++;
		sor++;
		num--;
	}
	return ret;
}
char* my_strncat(char* dest, const char* sor, size_t num)
{
	assert(dest && sor);
	char* ret = dest;
	while (*dest != '\0')
	{
		dest++;
	}
	while (*dest = *sor)
	{
		if (num == 1)
		{
			break;
		}
		dest++;
		sor++;
		num--;
	}
	return ret;
}
int main()
{
	char str1[100] = "silin";
	char str2 [100] = "code";
	my_strncpy(str1, str2, 3);
	printf("%s\n", str1);
	return 0;
}